XML是一種標記式語言,可延伸標記式語言(英語:Extensible Markup Language,簡稱:XML)。本文說明Python解析XML工具。
#Parse URLs into components
from urllib.parse import urlsplit
#XML sample:https://www.w3schools.com/xml/note.xml
url = 'Https://www.w3schools.com/xml/note.xml'
u_component = urlsplit(url)
print(u_component)
#scheme
print(u_component.scheme)
#netloc
print(u_component.netloc)